package com.woniuxy.charin.model.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Date;

/**
 * @TableName coupons
 */
@TableName(value ="coupons")
@Data
public class Coupons implements Serializable {
    @TableId(type = IdType.AUTO)
    private Integer id;

    private String name;//优惠券名称

    private String type;//优惠券类型
    public static final String DISCOUNT_COUPON = "折扣券";
    public static final String CASH_COUPON = "现金券";
    public static final String FULL_REDUCTION_COUPON = "满减券";

    private BigDecimal value;//优惠券面值
    // 添加满减券的满足金额字段
    private BigDecimal fullAmount;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime validFrom;//有效期开始时间

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime validUntil;//有效期结束时间

    private String applicableScope;//适用范围

    private String usageConditions;//使用条件

    public static final String STATUS_PUBLISHED = "发布";    // 修改为中文状态
    public static final String STATUS_UNPUBLISHED = "未发布";  // 修改为中文状态
    private String status;//状态


    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT)
    private Date createdTime;//创建时间
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date updateTime;
    private static final long serialVersionUID = 1L;
}